#include<stdio.h>
#include<string.h>
int main() {
    char s[10];
    int a,b,c;
    for(a=10; a<=31; a++)
        for(b=a; b<=31; b++)
            for(c=b; c<=31; c++) {
                sprintf(s,"%d%d%d",a*a,b*b,c*c);
                qsort(s,strlen(s),1,strcmp);
                if(strcmp(s,"123456789")==0)
                    printf("%d %d %d\n",a*a,b*b,c*c);
            }


    return 0;
}
